

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';


//白色字体14号
TextStyle whiteTextStyle14 = TextStyle(color: Colors.white, fontSize: 14.sp);
//白色字体15号
TextStyle whiteTextStyle15 = TextStyle(color: Colors.white, fontSize: 15.sp);
//标题文本15号
TextStyle titleTextStyle15 = TextStyle(color: Colors.black, fontSize: 15.sp);
//黑色字体13号
TextStyle blackTextStyle13 = TextStyle(fontSize: 13.sp, color: Colors.black);
//普通字体，只做判空处理
Text normalText(String? text) {
  return Text(text ?? "",style: titleTextStyle15,);
}

//白色通用输入组件
Widget commonInput({String? labelText,TextEditingController? controller,ValueChanged<String>? onChanged,bool? obscureText}){
  return TextField(
    obscureText: obscureText ?? false,
    controller: controller,
    onChanged: onChanged,
    style: TextStyle(color: Colors.white,fontSize: 14.sp),
    cursorColor: Colors.white,
    decoration: InputDecoration(
      //未获取焦点前边框样式
      enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white,width: 0.5.r)),
      focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.white,width: 1.r)),
      labelText: labelText ?? "请输入",
      labelStyle: const TextStyle(color: Colors.white)
    ),
  );
}

//白色圆角边框按钮
Widget whiteBorderButton({required String title,GestureTapCallback? onTap}){
  return GestureDetector(
    onTap: onTap,
    child: Container(
      alignment: Alignment.center,
      width: double.infinity,
      height: 45.h,
      margin: EdgeInsets.only(left: 40.w,right: 40.w),
      decoration: BoxDecoration(
        border: Border.all(color: Colors.white,width: 1.r),
        borderRadius: BorderRadius.all(Radius.circular(22.5.r))
      ),
      child: Text(
        title,
        style: TextStyle(color: Colors.white,fontSize: 15.sp),
      ),
    ),
  );
}


//收藏按钮
Widget collectImage(bool? collect, {GestureTapCallback? onTap}) {
  return GestureDetector(
      onTap: onTap,
      child: Image.asset(
          collect == true
              ? "assets/images/img_collect"
              ".png"
              : "assets/images/img_collect_grey.png",
          width: 25.r,
          height: 25.r));
}